#select elements from one vector based on another vector

select_vector <- function(
  ori_vec = c(),
  pattern_vec = c()
){
  logic_vec <- rep(F, length(ori_vec))
  for(i in 1:length(ori_vec)){
    for(j in 1:length(pattern_vec)){
      if(ori_vec[i] == pattern_vec[j]){
        logic_vec[i] <- T
      }
    }
  }
  return(logic_vec)
}

#### Test Area ####
# 
# select_vector(ori_vec = c("a001", "b001", "b002"), pattern_vec = c("a001", "b001"))
# 
# select_vector(ori_vec = c("a001", "b001", "b002", NA), pattern_vec = c("a001", "b001"))
